package com.dbz.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dbz.entity.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserDao extends BaseMapper<User> {
    /**
     * 查询全部
     * @return
     */
    public List<User> selectUser();


    /**
     * 根据名称查询用户信息
     *
     * @param userName
     * @return
     */
    public User getUserByName(String userName);

    /**
     * 根据用户名密码查询id
     *
     * @param userName
     * @param password
     * @return
     */
    public String getById(@Param("userName") String userName, @Param("password") String password);

    /**
     * 分页查询
     * @param page
     * @param queryMapper
     * @return
     */
    public IPage<User>selectPage(IPage<User> page,@Param(Constants.WRAPPER) Wrapper<User> queryMapper);

    /**
     * 移除用户角色
     * @param uid
     * @param rid
     * @return
     */
    public int delUserRolesByUidAndRid(@Param("uid") String uid,@Param("rid") String rid);
}
